<?php

/**
 * jwCustomTable form.
 *
 * @package    estate
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class ApartmanPricesForm extends BasejwCustomTableForm
{
  public function configure()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'type'        => new sfWidgetFormInputHidden(),
      'name'        => new sfWidgetFormInputHidden(),
      'description' => new sfWidgetFormInputHidden(),
      'values'        => new jwWidgetTableValues(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorPropelChoice(array('model' => 'jwCustomTable', 'column' => 'id', 'required' => false)),
      'type'        => new sfValidatorPass(),
      'name'        => new sfValidatorPass(),
      'description' => new sfValidatorPass(),
      'values' => new sfValidatorString(array('required' => false)),
    ));
    
    $this->setDefault( 'values', $this->getObject()->getValuesAsJSON() );
    $this->setDefault( 'type', 'apartman_price' );

    $this->widgetSchema->setNameFormat('apartman_price[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
  }
  
  public function bind( array $taintedValues = null, array $taintedFiles = null )
  {
	jwCustomTableForm::updateFromRequest( $this, &$taintedValues );

    parent::bind( $taintedValues, $taintedFiles );
  }
}
